package cn.demo.service;

        import cn.demo.entity.Book;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.cache.annotation.Cacheable;
        import org.springframework.stereotype.Component;

        import java.util.List;
@Component
    public class BookServiceImpl implements BookService{

    @Autowired
    BookService  bookService;

    @Cacheable(cacheNames = "Books" ,key = "#root.caches[0].name")
    public   int  addBook(Book book){
        return  bookService.addBook(book);
    };
    public   int  delBook(Integer id){
        return  bookService.delBook(id);
    };
    public  Book  getBookById(Integer id){
        return  bookService.getBookById(id);
    };
    public List<Book> getAllBook(){
        return  bookService.getAllBook();
    };


}
